import cv2
img=cv2.imread('puppy.jpg')
from PIL import Image
if img is not None and len(img.shape)==3:
    print('img.shape:',img.shape)
    show_img('img',img,-1)
    if img.shape[2]==3:
        b,g,r=cv2.split(img)
        show_img('b',b,-1)
        show_img('g', g, -1)
        show_img('r', r, -1)
    elif img.shape[2]==4:
        b, g, r, a = cv2.split(img)
        show_img('b', b, -1)
        show_img('g', g, -1)
        show_img('r', r, -1)
        show_img('a', a, -1)



